package beans;

import net.sourceforge.stripes.util.HtmlUtil;

/**
 * Class represented one row of table Forum (all forums) in db.
 * For easier work is there atribute for count of messages in forum,
 * last message in forum and name of user who create forum.
 * @author Tomas CASTA
 */
public class ForumBean {
    /** forum id */
    private int id;
    /** forum name */
    private String name;
    /** count of messages in this forum */
    private int count;
    /** last message int this forum */
    private MessageBean lastMessage;
    /** name of last message author */
    private String userName;

    /**
     * Constructor.
     * @param id int forum id
     * @param name String forum name
     * @param count int count of messages in this forum
     * @param lastMessage MessageBean last mesage in forum
     * @param userName String name of last message author
     */
    public ForumBean(int id, String name, int count, MessageBean lastMessage, String userName) {
        this.id = id;
        this.name = HtmlUtil.encode(name);
        this.count = count;
        this.lastMessage = lastMessage;
        this.userName = HtmlUtil.encode(userName);
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    

    public MessageBean getLastMessage() {
        return lastMessage;
    }

    public void setLastMessage(MessageBean lastMessage) {
        this.lastMessage = lastMessage;
    }
    

    public int getCount() {
        return count;
    }


    public void setCount(int count) {
        this.count = count;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    
}
